package ltd.hxya.novel.admin.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import ltd.hxya.novel.admin.entity.Role;
import com.baomidou.mybatisplus.extension.service.IService;
import ltd.hxya.novel.admin.vo.RoleVo;
import ltd.hxya.novel.admin.vo.UserVo;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.concurrent.ExecutionException;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author hty
 * @since 2022-10-04
 */
public interface IRoleService extends IService<Role> {

    Role roleByUserId(Integer userId);

    Page<Role> roleList(Role role);

    RoleVo roleInfo(Integer roleId) throws ExecutionException, InterruptedException;

    Page<UserVo> grantedUser(UserVo userVo);

    Page<UserVo> ungrantedUser(UserVo userVo);

    int grantRole(Integer roleId, Integer[] userIds);

    int revokeAll(Long roleId, Long[] userIds);

    void deleteById(Integer[] ids);
    // 添加角色的处理
    void addRole(Role role);
    // 修改操作
    void updateRole(Role role, HttpServletRequest requestr);

    // 获取角色的下拉列表
    List<Role> getRoleAll();

    // 根据roleIdlist可以查询到对应的role了
    List<Role> getRolesList(List<Integer> roleList);
}
